import static org.junit.Assert.*;

import java.text.ParseException;

import org.joda.time.DateTime;
import org.junit.Test;


public class AddParserTest {

	
	AddParser addParse = new AddParser();
	Task deadlineTask,floatTask,labelAndPriorityTask,labelTask,priorityTask;
	DateTime deadline,start,end;
	
	@Test
	public void testParse() throws ParseException {
		
		String data1 = "TEST_DATA -by 04/05/1999";
		String data2 = "TEST_DATA2 -from 03/01/1998 -to 09/03/2014";
		String data3 = "TEST_DATA3 -from 03/01/1998 -to 09/03/2014 -label CS2103T !";
		String data4 = "TEST_DATA4 -from 03/01/1998 -to 09/03/2014 -label RandomLabel";
		String data5 = "TEST_DATA5 -from 03/01/1998 -to 09/03/2014 ";
		
		deadlineTask = addParse.parse(data1);
		floatTask = addParse.parse(data2);
		labelAndPriorityTask = addParse.parse(data3);
		labelTask = addParse.parse(data4);
		priorityTask = addParse.parse(data5);
		
		deadline = deadlineTask.getDeadline();
		System.out.println("month: "+obtainMonth(deadline.getMonthOfYear()));
		System.out.println("Day of the week: "+obtainDay(deadline.getDayOfWeek()));
		
		start = floatTask.getStart();
		end = floatTask.getEnd();
		System.out.println("month: "+obtainMonth(end.getMonthOfYear()));
		System.out.println("Day of the week: "+obtainDay(end.getDayOfWeek()));
		
		System.out.println("Priority for labelAndPriorityTask: "+labelAndPriorityTask.isPriority());
		
		System.out.println("label for labelAndPrioirtyTask: "+labelAndPriorityTask.getLabel());
		
		System.out.println("label for labelTask: "+labelTask.getLabel());
		
		System.out.println("Priority for priorityTask: "+priorityTask.isPriority());
		
		
	}
	private String obtainDay(int day){
		switch(day){
		case 1:
			return "Monday";
		case 2:
			return "Tuesday";
		case 3:
			return "Wednesday";
		case 4:
			return "Thursday";
		case 5:
			return "Friday";
		case 6:
			return "Saturday";
		default: return "Sunday";
		}
	}
	private String obtainMonth(int month){
		switch(month){
		case 1:
			return "Jan";
		case 2:
			return "Feb";
		case 3:
			return "Mar";
		case 4:
			return "Apr";
		case 5:
			return "May";
		case 6:
			return "June";
		case 7:
			return "Jul";
		case 8:
			return "Aug";
		case 9:
			return "Sep";
		case 10:
			return "Aug";
		case 11:
			return "Nov";
		default:
			return "Dec";
		}
		
	}
}
